#include<iostream>
#include<cstdio>
using namespace std;
int n;
bool a[200010];
bool b[200010];
short aa=-1;
int main(){
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",a+i);
		if(a[i]!=aa){
			aa=a[i];
			b[i]=true;
			printf("%d ",i);
		}
	}
	printf("\n");
	bool flag;
	for(int i=2;i<=n;i++){
		flag=true;
		aa=-1;
		for(int j=i;j<=n;j++){
			if((!(b[j]))&&(a[j]!=aa)){
				aa=a[j];
				b[j]=true;
				printf("%d ",j);
				flag=false;
			}
		}
		if(flag){
			return 0;
		}
		printf("\n");
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}
